/*
  @Time:   2021-05-03
  @File:   hash加密等.go
  @Author: ls
*/
package main

import (
	"crypto/sha1"
	"encoding/hex"
	"fmt"
)

func main() {
	hSha1 := sha1.New()
	b := []byte{}
	data := []byte("This is data")
	n, err := hSha1.Write(data)
	if err != nil {
		return
	}
	fmt.Println(n)
	r := hSha1.Sum(b)
	fmt.Println(r)
	fmt.Println(hex.EncodeToString(r))

	fmt.Println(hSha1.Sum(data))
}


